<?php 
require_once "./Curl.php";


function create($thirdPartyUserId,$name,$idNumber,$mobile,$idType,$email,$appId,$secret,$url="https://smlopenapi.esign.cn"){
    $urlss = $url."/v1/accounts/createByThirdPartyUserId";
    $data = array(
        "thirdPartyUserId"=>$thirdPartyUserId,
        "name"=>$name,
        "idType"=>$idType,
        "idNumber"=>$idNumber,
        "mobile"=>$mobile,
        "email"=>$email
    );
    $res = json_encode($data);
    $header = getHeader($data,"POST","/v1/accounts/createByThirdPartyUserId",$appId,$secret);
    $b = sendHttp($method="POST",$urlss,$header,$res);
    return $b;
}
$thirdPartyUserId = "12231";  //唯一标识
$name = "刘颂晶11";
$idType = "CRED_PSN_CH_IDCARD";  //大陆身份证
$idNumber = "360731199907050379";
$mobile = "15179798856";
$email = "1937318982@qq.com";
$c = create($thirdPartyUserId,$name,$idNumber,$mobile,$idType,$email,$appId,$secret);
var_dump($c);die;




function update($accountId,$name,$mobile,$email,$appId,$secret,$url="https://smlopenapi.esign.cn"){
    $urlss = $url."/v1/accounts/".$accountId;
    $data = array(
        'accountId'=>$accountId,
        'mobile'=>$mobile,
        'email'=>$email,
        'name'=>$name
    );
    $res = json_encode($data);
    $header = getHeader($data,"PUT","/v1/accounts/f120cf3f2a124fc88f8438d6c919b8b6",$appId,$secret);
    $b = sendHttp($method="PUT",$urlss,$header,$res);
    return $b;
}
$accountId = "f120cf3f2a124fc88f8438d6c919b8b6";
$name = "liusongjing1111111111";
$mobile = "15179798866";
$email = "1@qq.com";
$data = array(
        'accountId'=>$accountId,
        'mobile'=>$mobile,
        'email'=>$email,
        'name'=>$name
    );
$a = update($accountId,$name,$mobile,$email,$appId,$secret);
var_dump($a);die
// $urlss = "https://smlopenapi.esign.cn/v1/accounts/f120cf3f2a124fc88f8438d6c919b8b6";
// $b = sendHttp($method="PUT",$urlss,$header,$res);
// var_dump($b);
// var_dump(222);

















 ?>